@import './theme/default';
@import './theme/font';

$menu-item-width: 240px;
$menu-item-height: 32px;
$menu-border-radius: 2px;

@mixin menu-hover {
  @include theme-color(background-color, primary, 8);
  @include theme-color(color, stroke, 1);
}

@mixin menu-disabled {
  @include theme-color(color, stroke, 5);
}

.zent-menu {
  @include theme-color(color, stroke, 1);
  @include theme-color(background-color, stroke, 9);
  @include theme-shadow(layer);
  font-size: $font-size-normal;
  width: $menu-item-width;
  list-style: none;
  padding: 0;
  margin: 0;
  border-radius: $menu-border-radius;

  &-item {
    width: 100%;
    height: $menu-item-height;
    line-height: $menu-item-height;
    text-align: left;
    padding-left: 16px;
    box-sizing: border-box;
    position: relative;
    cursor: pointer;

    &:first-child {
      border-top-left-radius: $menu-border-radius;
      border-top-right-radius: $menu-border-radius;
    }

    &:last-child {
      border-bottom-left-radius: $menu-border-radius;
      border-bottom-right-radius: $menu-border-radius;
    }

    &:hover {
      @include menu-hover;
    }

    &-disabled {
      @include menu-disabled;
      cursor: not-allowed;

      &:hover {
        @include menu-disabled;
        @include theme-color(background-color, stroke, 9);
      }
    }
  }

  .zenticon {
    margin-right: 16px;

    &.zent-submenu-title-operate-icon {
      margin-right: 0;
    }
  }

  .zenticon-right {
    @include theme-color(color, stroke, 3);
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
  }

  .zent-submenu > .zent-menu {
    position: absolute;
    top: 0;
    left: 100%;
    margin-left: 0;
  }

  .zent-submenu-title {
    margin-left: -10px;
    padding-left: 10px;

    &:hover {
      @include menu-hover;
    }

    &.zent-submenu-disabled {
      @include menu-disabled;
      @include theme-color(background-color, stroke, 9);
    }
  }
}

.zent-menu__inline {
  width: 200px;

  &-item {
    height: 40px;
    line-height: 40px;
    padding-left: 0;

    &:not(.zent-menu-item-disabled) {
      cursor: pointer;

      &:hover {
        @include theme-color(color, primary, 4);
      }
    }

    &-selected {
      @include theme-color(color, stroke, 9);
      @include theme-color(background-color, primary, 4);

      &:not(.zent-menu-item-disabled):hover {
        @include theme-color(color, stroke, 9);
        @include theme-color(background-color, primary, 3);
      }
    }
  }

  &-submenu {
    .zenticon-right {
      top: 16px;
      right: 20px;
      transform: rotate(90deg);
      transition: transform 200ms ease;
    }

    &-icon--expand.zenticon-right {
      transform: rotate(-90deg);
    }

    .zent-menu__inner {
      @include theme-color(background-color, stroke, 9);
      width: 100%;
      list-style: none;
      padding: 0;
      margin: 0;
    }

    &-title {
      width: 100%;
      height: 40px;
      line-height: 40px;
      text-align: left;
      padding-left: 10px;
      box-sizing: border-box;
      position: relative;
      cursor: pointer;

      &.zent-submenu-disabled {
        @include menu-disabled;
        cursor: not-allowed;
      }

      &:not(.zent-submenu-disabled):hover {
        @include theme-color(color, primary, 4);
        @include theme-color(background-color, stroke, 9);

        .zenticon {
          @include theme-color(color, primary, 4);
        }
      }
    }
  }
}
